package com.huawei.crm.mapper;

import com.huawei.crm.domain.Employee;
import com.huawei.crm.query.QueryObject;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface EmployeeMapper extends BaseRepository<Employee, Long> {

    List<Employee> selectAll();

    List<Employee> selectForList(QueryObject qo);

    void deleteByIds(Long[] ids);

    // 方法多个参数需要使用@Param注解来封装(Map)
    // 保存员工和角色的关系
    void insertEmpAndRoleRelation(@Param("empId") Long empId, @Param("roleId") Long roleId);

    // 删除员工和角色的关系
    void deleteEmpAndRoleRelation(@Param("empId") Long empId, @Param("roleId") Long roleId);

    Employee selectByName(String username);

    List<Employee> selectByRoleSns(String[] roleSns);

    void batchInsert(List<Employee> list);
}